package com.example.demo.controller;
import com.example.demo.entity.AuthAccountLog;
import com.example.demo.service.AuthAccountLogService;
import org.springframework.web.bind.annotation.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

import javax.annotation.Resource;

/**
 * 登录注册登出记录(AuthAccountLog)表控制层
 *
 * @author ElonChung
 * @since 2020-05-11 18:35:30
 */
@RestController
@Api(tags = "登录注册登出记录(AuthAccountLog)") 
@RequestMapping("authAccountLog")
public class AuthAccountLogController {
    /**
     * 服务对象
     */
    @Resource
    private AuthAccountLogService authAccountLogService;

    /**
     * 通过主键查询单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @ApiOperation(value = "根据id查询 登录注册登出记录")
    @GetMapping("getOne/{id}")
    public AuthAccountLog getOne(@PathVariable("id") Integer id) {
        return authAccountLogService.queryById(id);
    }
    
    /**
     * 新增 登录注册登出记录
     *
     * @param authAccountLog
     * @return 单条数据
     */
    @ApiOperation("新增 登录注册登出记录")
    @PutMapping("insert")
    public AuthAccountLog insert(@RequestBody AuthAccountLog authAccountLog) {
        return authAccountLogService.insert(authAccountLog);
    }

    /**
     * 修改 登录注册登出记录
     *
     * @param authAccountLog
     * @return 单条数据
     */
    @ApiOperation("修改 登录注册登出记录")
    @PostMapping("update")
    public AuthAccountLog update(@RequestBody AuthAccountLog authAccountLog) {
        return authAccountLogService.update(authAccountLog);
    }
    
    /**
     * 通过主键删除单条数据
     *
     * @param id 主键
     * @return 单条数据
     */
    @ApiOperation(value = "根据id删除 登录注册登出记录")
    @DeleteMapping("deleteById/{id}")
    public Boolean deleteById(@PathVariable("id") Integer id) {
        return authAccountLogService.deleteById(id);
    }
    
}